package thread;

/**
 * Created with IntelliJ IDEA.
 * Description: Thread(Runnable runnable, String name)构造方法的测试
 * User: 王圆豪
 * Date: 2025-04-22
 * Time: 21:07
 */
public class Demo6 {
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
           while (true) {
               System.out.println("Hello t1");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        },"t1");
        t1.start();

        Thread t2 = new Thread(()->{
            while (true) {
                System.out.println("Hello t2");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        },"t2");
        t2.start();

        Thread t3 = new Thread(()->{
            while (true) {
                System.out.println("Hello t3");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        },"t3");
        t3.start();
    }
}
